<?php

namespace Estore\Form;

use Zend\Form\Form;

class StoreproductsForm extends Form
{
		public function __construct($name = null)
		{
			parent::__construct('StoreproductForm');
			$this->setAttribute('method', 'post');
			$this->setAttribute('enctype','multipart/formdata');
			
			$this->add(array(
					'name' => 'name',
					'attributes' => array(
							'type' => 'text',
					),
					'options' => array(
							'label' => 'Product Name',
					),
			));
			$this->add(array(
					'name' => 'desc',
					'attributes' => array(
							'type' => 'text',
					),
					'options' => array(
							'label' => 'Description',
					),
					
					'filters' => array(
							array('name' => 'StringTrim'),
					),
					
					
			));
			
		    $this->add(array(
					'name' => 'cost',
		    		'options' => array(
		    				'label' => 'Cost',
		    		),
					'attributes' => array(
							'type' => 'text',
							'required' => 'required',
							'required name' => 'price',
							'maxlength' => '12',
					),
		    		
		    		'filters' => array(
		    				array('name' => 'StripTags'),
		    				array('name' => 'StringTrim'),
		    				array('name' => 'pregReplace',array('match' => '/\s+/', 'replace' => '')),
		    				array('name' => 'LocalizedToNormalized'),
		    		),
		    		
		    		'validators' => array(
		    				array(
		    						'name' => 'StringLength',
		    						'options' => array(
		    								array('min' => 1), array('max' => 12),
		    						),
		    						'name' => 'float',
		    						'options' => array(
		    								array('locale' => 'en_US'),
		    						),
		    						'name' => 'graterThen',
		    						'options' => array(
		    								array('min' => 0),
		    						),
		    				)
		    		)
		    		  		
			));
		    
		    
		    $this->add(array(
		    		'name' => 'submit',
		    		'type' => 'submit',
		    		'attributes' => array(
		    				'value' => 'Add',
		    		),
		    		
		    ));
		}
}

?>